#!/bin/bash

# 设置环境变量
export TENSORRT_ROOT="/data2/xd/TensorRT-8.5.1.7.Linux.x86_64-gnu.cuda-11.8.cudnn8.6/TensorRT-8.5.1.7"
export LD_LIBRARY_PATH="$TENSORRT_ROOT/lib:$LD_LIBRARY_PATH"
export CUDA_HOME="/usr/local/cuda"
export PATH="$CUDA_HOME/bin:$PATH"

echo "=== 编译Co-DETR ROS包 ==="
echo "TensorRT路径: $TENSORRT_ROOT"
echo "CUDA路径: $CUDA_HOME"

# 创建build目录
mkdir -p build
cd build

# 配置CMake
cmake .. \
    -DCMAKE_BUILD_TYPE=Release \
    -DCUDA_TOOLKIT_ROOT_DIR=$CUDA_HOME \
    -DTENSORRT_ROOT=$TENSORRT_ROOT

# 编译
make -j$(nproc)

echo "=== 编译完成 ===" 